//
//  YTStashLeftModel.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/11/11.
//

#import "YTStashLeftModel.h"

@implementation YTStashLeftModel
+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"ID":@[@"id"],
    };
}
+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{
        @"childList":[YTStashLeftModel class],
    };
}
- (CGFloat)nameW{
    if(_nameW == 0){
        _nameW = [DTKTool textWithtitle:self.name andSize:CGSizeMake(1000, 10000) andFout:kFont(15)].width + kwt(30);
        if(_nameW < kwt(75)){
            _nameW = kwt(75);
        }
    }
    return _nameW;
}
- (NSMutableArray<YTStashLeftModel *> *)AllchildList{
    if(!_AllchildList){
        _AllchildList = [NSMutableArray array];
        YTStashLeftModel * model = [YTStashLeftModel new];
        model.isSeled = YES;
        model.name = @"全部";
        model.ID = self.ID;
        [_AllchildList addObject:model];
        [_AllchildList addObjectsFromArray:self.childList];
    }
    return _AllchildList;
}
- (NSString *)SeledID{
    for (YTStashLeftModel * model in self.AllchildList) {
        if(model.isSeled){
            return model.ID;
        }
    }
    return self.ID;
}
- (NSString *)icon{
    if(self.isSeled){
        if(self.iconImg == 1){
            return @"warehouse_feed1";
        } else if(self.iconImg == 2){
            return @"warehouse_db1";
        } else if(self.iconImg == 3){
            return @"warehouse_gj1";
        } else if(self.iconImg == 4){
            return @"warehouse_sheb1";
        } else if(self.iconImg == 5){
            return @"warehouse_weih1";
        } else if(self.iconImg == 6){
            return @"warehouse_qt1";
        }
    } else {
        if(self.iconImg == 1){
            return @"warehouse_feed2";
        } else if(self.iconImg == 2){
            return @"warehouse_db2";
        } else if(self.iconImg == 3){
            return @"warehouse_gj2";
        } else if(self.iconImg == 4){
            return @"warehouse_sheb2";
        } else if(self.iconImg == 5){
            return @"warehouse_weih2";
        } else if(self.iconImg == 6){
            return @"warehouse_qt2";
        }
    }
    return @"";
}


@end
